package thread;

import java.util.concurrent.Semaphore;

public class demo30 {
    public static void main(String[] args) throws InterruptedException {
        Semaphore semaphore = new Semaphore(4);//指定参数申请了几个资源
        semaphore.acquire(2);//申请资源
        semaphore.release(2);//释放资源
    }
}
